<template>
	<view class="content">

		<view class="infoBox">
			<view class="top">
				<view class="num">
					{{(formDate.balance || 0)/100}}
				</view>
				<view class="txt">
					账户余额(元)
				</view>
			</view>
			<view class="middle">
				<view class="middleItem">
					<view class="txt">
						已结算收益(元)
					</view>
					<view class="num">
						{{(formDate.settlement || 0)/100}}
					</view>
				</view>
				<view class="middleItem">
					<view class="txt">
						已提现(元)
					</view>
					<view class="num">
						{{(formDate.transferAmount || 0)/100}}
					</view>
				</view>
				<view class="middleItem">
					<view class="txt">
						未结算(元)
					</view>
					<view class="num">
						{{(formDate.notCreditedPrize || 0)/100}}
					</view>
				</view>
			</view>
			<view class="bottom">
				每月25日，结算上月确认收货的订单奖励
			</view>
		</view>
		<view class="incomeBox">
			<view class="title">
				收益订单
			</view>
			<view class="incomeList" v-if="incomeList&&incomeList.length>0">
				<view class="incomeItem" v-for="(item,index) in incomeList" :key="item.id">
					<view class="head">
						<view class="left">

							<view class="avatar">
								<image :src="item.customer.avatar"></image>
							</view>
							<view class="name">
								{{item.customer.nickName}}
							</view>
						</view>
						<view class="status">
							<span v-if="item.status==1">待结算</span>
							<span v-if="item.status==2">已结算</span>
							<span v-if="item.status==3">已提现</span>
						</view>
					</view>
					<view class="orderBox">
						<view class="orderItem">
							<view class="label">
								订单号码
							</view>
							<view class="value">
								{{item.orderNo}}
							</view>
						</view>
						<view class="orderItem">
							<view class="label">
								下单时间
							</view>
							<view class="value">
								{{item.createTime}}
							</view>
						</view>
						<view class="orderItem">
							<view class="label">
								收益类型
							</view>
							<view class="value">
								{{inviterData[item.inviterType] }}
							</view>
						</view>
						<view class="orderItem">
							<view class="label">
								收益金额
							</view>
							<view class="value">
								￥{{ (item.inviterPrize || 0)/100 }}
							</view>
						</view>
					</view>
				</view>
			</view>
			<view class="nullData" v-else>
				<image src="../../static/follow/follow1.png" mode="widthFix"></image>
				<view class="txt">
					暂无收益订单
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getPrize
	} from '@/api/apis.js';
	export default {
		data() {
			return {
				formDate: {
					balance: 800,
					settled: 1200,
					reflect: 400,
					unsettled: 200,
				},
				incomeList: [],
				inviterData: [
					"会员邀请奖励",
					"店铺奖励",
					"商品推荐奖励"
				],

			};
		},
		onLoad() {},
		mounted() {
			this.onSearch()
		},
		methods: {
			onSearch() {
				getPrize().then(res => {
					console.log(res);
					this.formDate = res.result
					console.log(this.formDate);
					this.incomeList = res.result.shareList
				})
			}
		},

	}
</script>

<!-- // <style lang="scss">
	page {
		background-image: linear-gradient(to bottom, #FFEBEC, #F7F7F7, #F7F7F7);
	}
</style> -->
<style lang="scss" scoped>
	.content {
		background-image: linear-gradient(to bottom, #FFEBEC, #F7F7F7, #F7F7F7);

		// background-image: linear-gradient(to bottom, #FFEBEC, #F7F7F7,#F7F7F7);
		// background: linear-gradient(180deg, #F7F7F7 0%, rgba(247, 247, 247, 0) 100%);
		// padding: 30rpx 30rpx 70rpx 30rpx;
		min-height: 100%;
		padding-top: 30rpx;



		.infoBox {
			background-color: #FEE4C1;
			border-radius: 30rpx;
			margin: 0 30rpx;

			.top {
				display: flex;
				align-items: flex-end;
				justify-content: flex-start;
				padding: 50rpx 40rpx 30rpx;

				.num {
					color: #865A29;
					font-size: 60rpx;
					font-weight: bold;
				}

				.txt {
					font-size: 29rpx;
					margin: 0 0 12rpx 20rpx;
				}
			}

			.middle {
				padding: 30rpx 10rpx;
				margin: 0 25rpx;
				background-color: #fff;
				border-radius: 20rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;

				.middleItem {
					width: 33%;
					text-align: center;

					.txt {
						font-size: 25rpx;
						margin-bottom: 28rpx;
						color: #8E8E8E;
					}

					.num {
						font-weight: bold;
						font-size: 40rpx;
					}
				}
			}

			.bottom {
				color: #865A29;
				text-align: center;
				padding: 20rpx 0;
				font-size: 28rpx;
			}
		}

		.incomeBox {
			margin: 0 30rpx;

			.title {
				font-size: 36rpx;
				font-weight: bold;
				margin: 30rpx 0;
			}

			.incomeList {
				.incomeItem {
					background-color: #fff;
					border-radius: 30rpx;
					padding: 30rpx 25rpx;
					margin-bottom: 25rpx;

					.head {
						display: flex;
						align-items: center;
						justify-content: space-between;

						.left {
							display: flex;
							align-items: center;
							justify-content: flex-start;

							.avatar {
								width: 85rpx;
								height: 85rpx;
								margin-right: 20rpx;

								image {
									width: 100%;
									height: 100%;
									display: block;
								}
							}

							.name {
								font-size: 30rpx;
							}
						}

						.status {
							font-size: 31rpx;
							font-weight: bold;
						}
					}

					.orderBox {
						.orderItem {
							margin-top: 30rpx;
							display: flex;
							align-items: center;
							justify-content: space-between;
							font-size: 30rpx;

							.label {
								color: #8C8EA0;
							}

							.value {}
						}
					}
				}
			}

			.nullData {
				width: 100%;
				margin-top: 200rpx;

				image {
					width: 35%;
					margin: 0 auto;
					display: block;
				}

				.txt {
					text-align: center;
					color: #8C8EA0;
					font-size: 30rpx;
					margin-top: 20rpx;
				}
			}
		}
	}
</style>